#!/usr/bin/env python
#
# simple example how TreeWalker can be used as standalone application
#
import sys 
from pyflowctrl.core4 import Packet, EmptyStream
from pyflowctrl.core4.processes.treewalker2 import TreeWalker

if len(sys.argv) < 2:
    print 'Usage: treewalker2.py <path>'
    sys.exit()

tw = TreeWalker()
tw.io['input'].put(Packet(path=sys.argv[1]))
while True:
    tw.run_once()
    try:
        packet = tw.io['output'].get()
        print packet.path
    except EmptyStream:
        break

